<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  props: {
    info: { type: Object, required: true },
  },
});
</script>

<template>
  <view class="article-item">
    <view class="article-item-content">
      <view
        class="article-item-title"
        :style="{ height: info.pic_url ? '84rpx' : '' }"
      >
        {{ info.title }}
      </view>
      <view style="display: flex; align-items: center">
        <view class="article-item-date">{{ info.date }}</view>
        <view class="article-item-num">
          <image
            class="article-item-num2"
            src="@/package/novice/static/guide-article.png"
          />
          {{ info.click_num_str }}
        </view>
      </view>
    </view>
    <image
      class="article-item-img"
      v-if="info.pic_url"
      :src="info.pic_url"
      mode="aspectFill"
    />
  </view>
</template>

<style lang="scss">
.article-item {
  display: flex;
  align-items: center;
  padding: 20rpx;
  border-radius: 20rpx;
  background-color: #ffffff;

  .article-item-content {
    flex-grow: 1;
    min-width: 0;
  }

  .article-item-title {
    margin-bottom: 20rpx;
    font-size: 30rpx;
    color: #333333;
    line-height: 42rpx;
    font-weight: bold;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .article-item-date {
    font-size: 24rpx;
    color: #bbbbbb;
    line-height: 34rpx;
  }

  .article-item-num {
    display: flex;
    align-items: center;
    height: 34rpx;
    margin-left: auto;
    font-size: 24rpx;
    color: #999999;
  }

  .article-item-num2 {
    width: 28rpx;
    height: 28rpx;
    margin-right: 6rpx;
  }

  .article-item-img {
    flex-shrink: 0;
    width: 190rpx;
    height: 140rpx;
    margin-left: 30rpx;
    border-radius: 10rpx;
  }
}
</style>